<template>
  <div>
    <ul>
      <li v-for="(value, index) in arr" :key="value">
        {{ value }}
        <button @click="ptn(index)">删除</button>
      </li>
    </ul>
    <button @click="btn">增加</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [1, 2, 3],
    };
  },
  methods: {
    btn() {
      this.arr.push(Math.ceil(Math.random() * 100));
    },
    ptn(abb) {
      this.arr.splice(abb, 1);
    },
  },
};
</script>

<style>
</style>
